<template>
    <mu-paper class="paperz" :zDepth="2">

        <el-table
                :data="tableData"
                style="width: 100%;">
            <el-table-column
                    prop="id"
                    label="序号"
                    width="100"
            >
            </el-table-column>
            <el-table-column
                    prop="order"
                    label="订单号"
                    width="200"
            >
            </el-table-column>
            <el-table-column
                    prop="taobao"
                    label="多多号"
                    width="100"
            >
            </el-table-column>
            <el-table-column
                    prop="taobao"
                    label="支付账号"
                    width="100"
            >
            </el-table-column>
            <el-table-column
                    prop="taobao"
                    label="余额"
                    width="100"
            >
            </el-table-column>
            <el-table-column
                    prop="shop"
                    label="店铺"
                    width="100"
            >
            </el-table-column>
            <el-table-column
                    prop="moneyStatus"
                    label="淘宝交易状态"
                    width="100"
            >
                <template slot-scope="scope">
                    <div v-if="scope.row.moneyStatus=== '0'">已评论</div>
                    <div v-if="scope.row.moneyStatus=== '1'">退款</div>
                </template>
            </el-table-column>
            <el-table-column
                    prop="img"
                    label="首次评价截图"
                    width="180"
            >
                <template slot-scope="scope">
                    <img :src="'http://www.7s6u.cn/upload/' + scope.row.img" style="height: 100px;">
                </template>
            </el-table-column>
            <el-table-column
                    prop="imgplus"
                    label="追加评价截图"
                    width="180"
            >
                <template slot-scope="scope">
                    <img :src="'http://www.7s6u.cn/upload/' + scope.row.imgplus" style="height: 100px;">
                </template>
            </el-table-column>
            <el-table-column
                    prop="user"
                    label="入口"
                    width="100"
            >
            </el-table-column>
            <el-table-column
                    prop="user"
                    label="主动联系人"
                    width="100"
            >
            </el-table-column>
            <el-table-column
                    prop="user"
                    label="审核人"
                    width="100"
            >
            </el-table-column>
            <el-table-column
                    prop="status"
                    label="状态"
                    width="100"
            >
                <template slot-scope="scope">
                    <div v-if="scope.row.status=== '1001'">首次评价审核通过</div>
                    <div v-else-if="scope.row.status=== '1002'">首次评价审核未通过</div>
                    <div v-else-if="scope.row.status=== '2001'">追加评价审核通过</div>
                    <div v-else-if="scope.row.status=== '2002'">追加评价审核未通过</div>
                    <div v-else-if="scope.row.status=== '0'">未审核</div>
                    <div v-else>审核失败</div>
                </template>
            </el-table-column>
            <el-table-column label="操作" width="500">
                <template slot-scope="scope">
                    <el-button
                            @click="swStatus(scope.row.id, '1')">
                        {{scope.row.status=== '0'?'首次好评格式通过':'追加评价审核通过'}}

                    </el-button>
                    <el-button
                            @click="swStatus(scope.row.id, '2')">
                        {{scope.row.status=== '0'?'首次好评格式不通过':'追加评价审核不通过'}}
                    </el-button>


                </template>
            </el-table-column>
        </el-table>

        <el-dialog title="" :visible.sync="goodUpdate" custom-class="backupdedleteUserDialog">
            <el-form label-width="110px">
                <el-form-item label="评价">
                    <el-input auto-complete="off" type="textarea" autosize
                              :autosize="{ minRows: 3, maxRows: 12}"></el-input>
                </el-form-item>
                <el-form-item label="图片">
                    <el-upload
                            ref="upload1"
                            class="upload-demo"
                            action="http://39.104.83.69:2727/v1/api/other/UploadImg"
                            multiple
                            name="1"
                            :data="list"
                            :auto-upload="false"
                            :limit="6"
                            :on-success="uploadSuccess"
                    >
                        <el-button size="small" type="primary">点击上传</el-button>
                    </el-upload>
                </el-form-item>
                <el-form-item label="追加评论">
                    <el-input auto-complete="off" type="textarea" v-model='list.text2' autosize
                              :autosize="{ minRows: 3, maxRows: 12}"></el-input>
                </el-form-item>


                <el-form-item label="追加图片" style="float: left">
                    <el-upload
                            ref="upload2"
                            class="upload-demo"
                            action="http://39.104.83.69:2727/v1/api/other/UploadImg"
                            name="2"
                            multiple
                            :data="list"
                            :auto-upload="false"
                            :limit="6"
                            :on-success="uploadSuccess"
                    >
                        <el-button size="small" type="primary">点击上传</el-button>

                    </el-upload>
                </el-form-item>
                <el-form-item label="追加金额">
                    <el-select v-model="value2" placeholder="请选择">
                        <el-option
                                v-for="item in options2"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item style="text-align: center;">
                    <el-button type="primary" style="width: 200px;" @click="submitUpload">上传</el-button>
                </el-form-item>
            </el-form>
        </el-dialog>
    </mu-paper>
</template>
<script>
    export default {
        name: 'AdminGoodComment',
        data() {
            return {
                value2: '2元',
                options2: [
                    {
                        value: 2,
                        label: '2元'
                    },
                    {
                        value: 3,
                        label: '3元'
                    },
                    {
                        value: 4,
                        label: '4元'
                    },
                    {
                        value: 5,
                        label: '5元'
                    },
                ],
                list: {},
                goodUpdate: false,
                tableData: []
            }
        },
        methods: {
            getGoodCommentList() {
                let _this = this;
                _this.$http.post("/api/api.php", {
                    id: "getGoodCommentList",

                }).then(function (response) {
                    _this.tableData = response.data.data;
                });
            },
            swStatus(a, b) {
                let _this = this;
                let title;
                b === '1' ? title = '通过后将立即打款给用户' : title = '确认不通过吗';
                _this.$confirm(title, "提示", {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    type: "warning"
                }).then(() => {
                    _this.$http.post("/api/api.php", {
                        id: "swStatus",
                        status: b,
                        user: a,
                    }).then(function (response) {
                        _this.getGoodCommentList();
                    });
                });
            }
        },
        mounted() {
            this.getGoodCommentList();
        }
    }
</script>
<style>
    .paperz {
        height: 90%;
        padding: 15px;
    }
</style>
